﻿using System;
using BlueDot.Mobile.Core;

namespace NotifyIconConfiguration
{
    public class MainApplication : MobileApplication<MainShell>
    {
        #region Fields

        private string applicationName = "Main Application";

        #endregion

        #region Constructors

        /// <summary>
        /// Initializes a new instance of the ScalperInternationalApplication class.
        /// </summary>
        public MainApplication()
        {
            Configuration = new BlueDot.Mobile.Core.NotifyIconConfiguration();
        }

        #endregion

        #region Properties

        public override string Name
        {
            get { return applicationName; }
            set { applicationName = value; }
        }

        #endregion

        #region public

        public override void AddWorkflowDirector()
        {
            AddNew<MainWorkflowDirector, IWorkflowDirector>();
        }

        #endregion

        /// <summary>
        /// You only need to enable this if you are using the NotifyIcon configuration.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="args"></param>
        [Receiver(WellKnownActions.ApplicationRun)]
        public void NotifyIconHasBeenClicked(object sender, EventArgs args)
        {
            // If we are using the notify icon config, then we want to run the app at this point.
            if (this.Status != ApplicationStatus.Running)
            {
                Run();
            }
            else
            {
                Show();
            }
        }
    }
}